package com.itheima.duotai.test6;

import java.sql.SQLOutput;

public class Demo6 {
    public static void main(String[] args) {
        Breeder breeder = new Breeder();
        breeder.breed(new Dog(),"骨头");
        new Dog().swim();
        breeder.breed(new Frog(),"小虫");
        new Frog().swim();
        breeder.breed(new Sheep(),"青草");
    }
}

abstract class Animal {
    private int age;

    public Animal() {
    }

    public Animal(int age) {
        this.age = age;
    }

    public void drink() {
        System.out.println("喝水");
    }
    public abstract void eat(String something);
}
interface Swimming{
    void swim();
}
class Dog extends Animal implements Swimming{
    @Override
    public void eat(String something) {
        System.out.println("狗啃"+something);
    }

    @Override
    public void swim() {
        System.out.println("狗会狗刨游泳");
    }
}
class Frog extends Animal implements Swimming{
    @Override
    public void eat(String something) {
        System.out.println("青蛙吃"+something);
    }

    @Override
    public void swim() {
        System.out.println("青蛙会蛙泳");
    }
}
class Sheep extends Animal {
    @Override
    public void eat(String something) {
        System.out.println("羊吃"+something);
    }
}
class Breeder{
    public void breed(Animal a,String something){
        a.drink();
        a.eat(something);
    }
}